#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+1000;
typedef long long LL;
typedef pair<LL,LL>S;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL a[maxn];
struct P{
  LL x,y;
};
queue<S>que1,que2;
vector<P>ans;
LL row[maxn],col[maxn];
int main(void){
   cin.tie(0);std::ios::sync_with_stdio(false);
   LL n;cin>>n;
   for(LL i=1;i<=n;i++) cin>>a[i];
   bool flag=1;
   for(LL i=n;i>=1;i--){
       if(a[i]==0) continue;
       else if(a[i]==1){
           que1.push({i,i});
           ans.push_back({i,i});
           ++row[i];++col[i];
       }
       else if(a[i]==2){
           if(que1.empty()){
              flag=0;break;
           }
           S x=que1.front();que1.pop();
           ans.push_back({x.first,i});
           que2.push({x.first,i});
           ++row[x.first];++col[i];
       }
       else if(a[i]==3){
           if(!que2.empty()){
              S x=que2.front();que2.pop();
              LL temp=x.first-1;
              while(temp>=1&&row[temp]) temp--;
              if(temp<1) break;
              ans.push_back({temp,i});
              ans.push_back({temp,x.second});
              row[temp]+=2;col[i]++;col[x.second]++;
              que2.push({temp,i});
           }
           else if(!que1.empty()){
              S x=que1.front();que1.pop();
              LL temp=x.first-1;
              while(temp>=1&&row[temp]) temp--;
              if(temp<=0) break;
              ans.push_back({temp,i});
              ans.push_back({temp,x.second});
              row[temp]+=2;col[i]++;col[x.second]++;
              que2.push({temp,i});
           }
           else{
             flag=0;break;
           }
       }
   }
   if(flag){
      cout<<ans.size()<<"\n";
      for(LL i=0;i<ans.size();i++){
          cout<<ans[i].x<<" "<<ans[i].y<<"\n";
      }
   }
   else{
      cout<<"-1"<<"\n";
   }
   return 0;
}
